﻿<Window x:Class="WikiQuizz.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WikiQuizz.ViewModel"
        Title="MainWindow" Height="301" Width="850">

    <Window.Resources>
        <local:BoolToColorConverter x:Key="BoolToColorConverter" />
        
        <LinearGradientBrush x:Key="GridBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientStop Offset="0" Color="#000033"/>
            <GradientStop Offset="0.7" Color="#0000CC"/>
            <GradientStop Offset="1" Color="#0033CC"/>
        </LinearGradientBrush>

        <ControlTemplate x:Key="BlueButton" TargetType="{x:Type Button}">
            <Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="3">
                <Border BorderBrush="DarkBlue" BorderThickness="1" CornerRadius="3">
                    <Grid Name="ButtonGrid">
                        <Rectangle Name="ButtonRect">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="#000033" />
                                    <GradientStop Offset="0.49" Color="#0000CC" />
                                    <GradientStop Offset="0.5" Color="#0000CC" />
                                    <GradientStop Offset="1" Color="#000033" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" />
                    </Grid>
                </Border>
            </Border>
            <ControlTemplate.Triggers>                
                <Trigger Property="IsMouseOver" Value="True">                    
                    <Setter Property="Fill" TargetName="ButtonRect">
                        <Setter.Value>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Offset="0" Color="LightBlue" />
                                <GradientStop Offset="1" Color="#0000CC" />
                            </LinearGradientBrush>
                        </Setter.Value>
                    </Setter>                    
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect GlowColor="White" GlowSize="5" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Fill" TargetName="ButtonRect" Value="DarkBlue" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="GreenButton" TargetType="{x:Type Button}">
            <Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="3">
                <Border BorderBrush="DarkGreen" BorderThickness="1" CornerRadius="3">
                    <Grid Name="ButtonGrid">
                        <Rectangle Name="ButtonRect">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="#006600" />
                                    <GradientStop Offset="0.49" Color="#009933" />
                                    <GradientStop Offset="0.5" Color="#009933" />
                                    <GradientStop Offset="1" Color="#006600" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" />
                    </Grid>
                </Border>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="ButtonRect">
                        <Setter.Value>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Offset="0" Color="LightGreen" />
                                <GradientStop Offset="1" Color="#006600" />
                            </LinearGradientBrush>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect GlowColor="White" GlowSize="5" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Fill" TargetName="ButtonRect" Value="DarkGreen" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="RedButton" TargetType="{x:Type Button}">
            <Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="3">
                <Border BorderBrush="DarkRed" BorderThickness="1" CornerRadius="3">
                    <Grid Name="ButtonGrid">
                        <Rectangle Name="ButtonRect">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="#660000" />
                                    <GradientStop Offset="0.49" Color="#FF6666" />
                                    <GradientStop Offset="0.5" Color="#FF6666" />
                                    <GradientStop Offset="1" Color="#660000" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" />
                    </Grid>
                </Border>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="ButtonRect">
                        <Setter.Value>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Offset="0" Color="#FF6666" />
                                <GradientStop Offset="1" Color="#660000" />
                            </LinearGradientBrush>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect GlowColor="White" GlowSize="5" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Fill" TargetName="ButtonRect" Value="DarkGreen" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    <Grid Background="{StaticResource GridBackgroundBrush}">
        <Button Content="Next Question" Height="23" HorizontalAlignment="Left" 
                Margin="12,12,0,0" Name="button1" VerticalAlignment="Top" Width="113"  
                Command="{Binding Path=GetExtract}"
                Foreground="White" Template="{DynamicResource BlueButton}" />
        <Button Content="New Game" Height="23" HorizontalAlignment="Left" 
                Margin="131,12,0,0" Name="button2" VerticalAlignment="Top" Width="113" 
                Command="{Binding Path=StartNewGame}" 
                Foreground="White" Template="{DynamicResource BlueButton}"/>
        <Button Content="{Binding Path=What}" Height="23" HorizontalAlignment="Left" Margin="698,12,0,0" Name="button3" VerticalAlignment="Top" Width="113" 
                Command="{Binding Path=StartBrowser}" 
                Foreground="White" Template="{DynamicResource BlueButton}" />
        <Border BorderBrush="Silver" BorderThickness="1" Height="200" HorizontalAlignment="Left" Margin="12,50,0,0" Name="border1" VerticalAlignment="Top" Width="800">
            <StackPanel Name="stackPanel1">
                <TextBlock Height="100" Name="textBlock1" Text="{Binding Path=Question, Mode=TwoWay}" TextAlignment="Center" TextWrapping="Wrap" FontSize="28" FontWeight="Bold" Foreground="White"/>
                <Grid Name="grid1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="400"/>
                        <ColumnDefinition Width="400"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="50"/>
                    </Grid.RowDefinitions>
                    <Button Grid.Column="0" Grid.Row="0" Content="{Binding Path=AnswerA, Mode=TwoWay}" Command="{Binding Path=GetAnswerA, Mode=OneWay}" 
                            HorizontalAlignment="Stretch" Margin="5" Name="AnswerA" VerticalAlignment="Stretch" Tag="1" 
                            Foreground="White" Template="{DynamicResource BlueButton}"/>
                    <Button Grid.Column="1" Grid.Row="0" Content="{Binding Path=AnswerB, Mode=TwoWay}" Command="{Binding Path=GetAnswerB, Mode=OneWay}"
                            HorizontalAlignment="Stretch" Margin="5" Name="AnswerB" VerticalAlignment="Stretch" Tag="2" 
                            Foreground="White" Template="{DynamicResource BlueButton}"/>
                    <Button Grid.Column="0" Grid.Row="1" Content="{Binding Path=AnswerC, Mode=TwoWay}" Command="{Binding Path=GetAnswerC, Mode=OneWay}"
                            HorizontalAlignment="Stretch" Margin="5" Name="AnswerC" VerticalAlignment="Stretch" Tag="3" 
                            Foreground="White" Template="{DynamicResource BlueButton}"/>
                    <Button Grid.Column="1" Grid.Row="1" Content="{Binding Path=AnswerD, Mode=TwoWay}" Command="{Binding Path=GetAnswerD, Mode=OneWay}"
                            HorizontalAlignment="Stretch" Margin="5" Name="AnswerD" VerticalAlignment="Stretch" Tag="4"                             
                            Foreground="White" >
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Template" Value="{DynamicResource BlueButton}" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding RightAnswer}" Value="True">                             
                                        <Setter Property="Template" Value="{DynamicResource GreenButton}" />
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding RightAnswer}" Value="False">
                                        <Setter Property="Template" Value="{DynamicResource RedButton}" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
                </Grid>
            </StackPanel>
        </Border>
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="250,12,0,0" Name="textBlock2" 
                   Text="Correct answers:" VerticalAlignment="Top" Foreground="White"/>
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="340,12,0,0" Name="textBlock3" 
                   Text="{Binding Path=CorrectAnswers, Mode=OneWay}" VerticalAlignment="Top" Width="25" Foreground="White"/>
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="380,12,0,0" Name="textBlock4" 
                   Text="Incorrect answers:" VerticalAlignment="Top" Foreground="White"/>
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="478,12,0,0" Name="textBlock5" 
                   Text="{Binding Path=InCorrectAnswers, Mode=OneWay}" VerticalAlignment="Top" Width="25" Foreground="White"/>        
    </Grid>
</Window>
